//
//  LibLevelDBTests.m
//  LibLevelDBTests
//
//  Created by ChangtanSun on 2017/11/6.
//  Copyright © 2017年 finchina. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "LibLevelDB.h"

@interface LibLevelDBTests : XCTestCase

@end

@implementation LibLevelDBTests

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
    
    [self testExample];
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testExample {
    // This is an example of a functional test case.
    // Use XCTAssert and related functions to verify your tests produce the correct results.
    
    DBManager *db = [[DBManager alloc] initWithDBName: @"testLevelDB"];
    
    [db setBool:true forKey: @"key_bool"];
    XCTAssertEqual([db boolForKey: @"key_bool"], true);
    
    [db setInt:1000 forKey: @"key_int"];
    XCTAssertEqual([db intForKey: @"key_int"], 1000);
    
    [db removeValueForKey: @"key_int"];
    XCTAssertEqual([db intForKey: @"key_int"], 0);
    
    XCTAssertEqual([db stringForKey: @"key_String"], NULL);
    
    XCTAssertEqual([db deleteDB], true);
}

- (void)testPerformanceExample {
    // This is an example of a performance test case.
    [self measureBlock:^{
        // Put the code you want to measure the time of here.
    }];
}

@end
